<html>
    <head>
    </head>
    <body>
        <?php $lang = Yii::app()->session['_lang']; ?>
        <table cellpadding="0" cellspacing="0" border="0" width="100%">
            <tbody>
                <tr style="height:19.95pt">
                    <td style="padding:10px;font-size:12px;font-family:arial,sans-serif;width:180px">
                        <a href="http://m.silverlandhotels.com/<?= $booked['hotel'] ?>.html" title="Silverland - Tan Hai Long Hotel Group" target="_blank">
                            <img src="http://silverlandhotels.com/data/uploads/logo/<?= str_replace(' ', '', $hotel_info['logo']) ?>" height="70"></a></td>
                    <td colspan="7" style="padding:10px;height:19.95pt;font-size:12px" valign="top">
                        <h1 style="font-size:18px;font-family:arial,sans-serif;margin:0">
                            <?= $hotel_name ?>
                        </h1>
                        <span style="font-family:arial,sans-serif;font-size:12px">
                            Add: <?= $hotel_info['address'][$lang] ?>, <?= $hotel_info['city'][$lang] ?>, <?= $hotel_info['country'][$lang] ?></span><br>
                        Website: <u><span style="color:blue"><a href="http://m.silverlandhotels.com" target="_blank">m.silverlandhotels.com</a></span></u>
            <br>
            Email: <u><span style="color:blue"><a href="mailto:<?= $hotel_info['email'] ?>" target="_blank"><?= $hotel_info['email'] ?></a></span></u>
            <br>
            <?php if ($hotel_info['hotline']): ?>
                Hotline 24/7: <?= $hotel_info['hotline'] ?>
            <?php endif; ?></td>
            </tr>
            </tbody>
        </table>
        <table style="border-collapse:collapse;width:100%" cellpadding="0" cellspacing="0" border="1">
            <tbody>
                <tr>
                    <td align="center" valign="top">
                        <h2>RESERVATION LETTER</h2>
                    </td>
                </tr>
                <tr>
                    <td style="padding:10px;font-size:12px;font-family:arial,sans-serif" align="right" valign="top">Code: <strong><?= strtoupper($booked['short_id']) ?></strong><br>
                        Date: <?= date('d M y H:m:s', $booked['requestDate']->sec) ?></td>
                </tr>
                <tr>
                    <td valign="top">
                        <table cellpadding="0" cellspacing="0" border="0" width="100%">
                            <tbody>
                                <tr>
                                    <td style="padding:10px;font-size:12px;font-family:arial,sans-serif" align="left" width="100px">Booker:</td>
                                    <td style="padding:10px;font-size:12px;font-family:arial,sans-serif" align="left" width="100px"><?= $booked['contact']['gender'] ?>. <?= $booked['contact']['firstname']; ?></td>
                                </tr>
                                <tr>
                                    <td style="padding:10px;font-size:12px;font-family:arial,sans-serif" align="left" width="100px">Email:</td>
                                    <td style="padding:10px;font-size:12px;font-family:arial,sans-serif" align="left">
                                        <a href="mailto:<?= $booked['contact']['email']; ?>" target="_blank"><?= $booked['contact']['email']; ?></a></td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td valign="top">
                        <table style="border-collapse:collapse;width:100%" cellpadding="10" cellspacing="0" border="1" width="100%">
                            <tbody>
                                <tr>
                                    <td style="padding:10px;font-size:12px;font-family:arial,sans-serif" align="center" width="5%"><strong>No</strong></td>
                                    <td align="center"><strong>Guest stay</strong></td>
                                    <td style="padding:10px;font-size:12px;font-family:arial,sans-serif;width:25%" align="center"><strong>Room type</strong></td>
                                    <td style="padding:10px;font-size:12px;font-family:arial,sans-serif;width:5%" align="center"><strong>Adults</strong></td>
                                    <td style="padding:10px;font-size:12px;font-family:arial,sans-serif;width:5%" align="center"><strong>Children</strong></td>
                                    <td style="padding:10px;font-size:12px;font-family:arial,sans-serif;width:5%" align="center"><strong>Extra bed</strong></td>
                                    <td style="padding:10px;font-size:12px;font-family:arial,sans-serif;width:5%" align="center"><strong>Check-in</strong></td>
                                    <td style="padding:10px;font-size:12px;font-family:arial,sans-serif;width:5%" align="center"><strong>Check-out</strong></td>
                                    <td style="padding:10px;font-size:12px;font-family:arial,sans-serif;width:12%" align="center"><strong>Price (<?= Yii::app()->session['_change_currency'] ?>)</strong></td>
                                </tr>
                                <?php
                                $i = 1;
                                $dateArr = 0;
                                $totalRate = 0;
                                $totalpriceAirport = 0;
                                $htmlCancelRoom = "";
                                $order = 1;
                                foreach ($booked['matchRoom'] as $k => $v) {
                                    $checkIn = date('d M y', substr($k, 0, 10));
                                    $checkOut = date('d M y', substr($k, 10, 20));
                                    foreach ($v as $key => $value) {
                                        ?>
                                        <tr>
                                            <td style="padding:10px;font-size:12px;font-family:arial,sans-serif" align="center"><?= $order; ?></td>
                                            <td style="padding:10px;font-size:12px;font-family:arial,sans-serif" align="center">
                                                <?php
                                                $guestNo = 0;
                                                $guestdetails = $booked->guestdetails;
                                                foreach ($guestdetails as $guest => $val) {
                                                    foreach ($guestdetails[$guest][$i - 1] as $g => $h) {
                                                        echo $h . ' ';
                                                        if ($guestNo % 2) {
                                                            echo "<br>";
                                                        }
                                                        $guestNo++;
                                                    }
                                                }
                                                ?>
                                            </td>
                                            <td style="padding:10px;font-size:12px;font-family:arial,sans-serif" align="center">
                                                <?php echo strtoupper($value['roomTypeName']); ?><br><?php echo $value['promotion_name']; ?>
                                            </td>
                                            <td style="padding:10px;font-size:12px;font-family:arial,sans-serif" align="center"><?php echo $value['adult']; ?></td>
                                            <td style="padding:10px;font-size:12px;font-family:arial,sans-serif" align="center"><?php echo $value['children']; ?></td>
                                            <td style="padding:10px;font-size:12px;font-family:arial,sans-serif" align="center"><?php echo $value['extrabed']; ?></td>
                                            <td style="padding:10px;font-size:12px;font-family:arial,sans-serif" align="center"><?php echo $checkIn; ?></td>
                                            <td style="padding:10px;font-size:12px;font-family:arial,sans-serif" align="center"><?php echo $checkOut; ?></td>
                                            <td style="padding:10px;font-size:12px;font-family:arial,sans-serif" align="center"><?php echo number_format($value['rate'], 2, '.', ','); ?></td>
                                        </tr>
                                        <?php
                                        $htmlCancelRoom .= '<p><strong>' . strtoupper($value['roomTypeName']) . ' - ' . $value['promotion_name'] . '</strong><br>';
                                        $htmlCancelRoom .= '<strong>Cancellation Policy:</strong><br>';
                                        $htmlCancelRoom .= $value['police']['cancel1'] . '<br>';
                                        if (isset($value['police']['cancel2']))
                                            $htmlCancelRoom .= $value['police']['cancel2'];
                                        if (isset($value['police']['cancel3']))
                                            $htmlCancelRoom .= $value['police']['cancel3'];
                                        $htmlCancelRoom .= '</p>';

                                        $totalRate += $value['rate'];
                                        $order++;
                                    }
                                    $i++;
                                    $dateArr++;
                                }
                                ?>
                                <?php if ($booked->specialRequest): ?>
                                    <tr>
                                        <td style="padding:10px;font-size:12px;font-family:arial,sans-serif" align="left">Note:</td>
                                        <td style="padding:10px;font-size:12px;font-family:arial,sans-serif" align="left" colspan="8"><?php echo $booked->specialRequest; ?></td>
                                    </tr>
                                <?php endif; ?>
                            </tbody>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td valign="top">
                        <table cellpadding="0" cellspacing="0" border="0" width="100%">
                            <tbody>
                                <tr>
                                    <td style="padding:10px" align="left" valign="top"><strong>Arrival
                                            airport:</strong></td>
                                    <td style="padding:10px" align="left" valign="top">
                                        <?php
                                        if ($booked['flightInfo']['status'] == "") {
                                            $data = $booked->flightInfo;
                                            echo $data['arrivalFilight0'] . ' - ';
                                            echo $data['arrivalTime0'];
                                            echo ' ';
                                            echo $data['arrivaltDate0'];
                                            echo '<br>';
                                        }
                                        if ($booked->airportInfo['tranferFee']['Status0'] == '1') {
                                            echo '<b>Fee (' . Yii::app()->session['_change_currency'] . '): </b>';
                                            if ($booked['airportInfo']['tranferFee']['Price0'] == 0) {
                                                echo 'Free pickup';
                                            } else {
                                                echo number_format($booked['airportInfo']['tranferFee']['Price0'], 2, '.', ',');
                                                $totalpriceAirport += $booked['airportInfo']['tranferFee']['Price0'];
                                            }
                                        }
                                        ?> </td>
                                    <td style="padding:10px" align="left" valign="top"><strong>Airport
                                            drop off:</strong></td>
                                    <td style="padding:10px" align="left">
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4" style="padding:10px" align="left">
                                        For information, please contact: <strong><a href="mailto:<?= $hotel_info['email'] ?>" target="_blank">
                                                <?= $hotel_info['email'] ?></a></strong>
                                        or <strong><?= $hotel_info['tel'] ?></strong><br>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
                <?php
                $salesTax = $hotel_info['sales_tax'];
//get % Service charge rate
                $serviceChargeRate = $hotel_info['service_charge_rate'];
//summary thue
                $totalTax = $salesTax + $serviceChargeRate + (($serviceChargeRate * $salesTax) / 100);
                $totalRate_no_Tax = $totalRate + $totalpriceAirport;
                ?>
                <tr>
                    <td style="padding:10px" align="left" valign="top"><strong>Total
                            to be paid in <?= Yii::app()->session['_change_currency'] ?> (include VAT & Service Charge Rate): <?php echo number_format(($totalRate_no_Tax + ($totalRate_no_Tax * ($totalTax / 100))), 2, '.', ',') ?></strong> (~ <?php echo number_format(($totalRate_no_Tax + ($totalRate_no_Tax * ($totalTax / 100)))*$booked['changeCurrency'], 2, '.', ',') ?> VND)</td>
                </tr>
                <tr>
                    <td style="padding:10px" align="left" valign="top">
                        <?php echo $htmlCancelRoom; ?>
                    </td>
                </tr>
                <tr>
                    <td style="padding:10px" align="left" valign="top">
                        <?php echo $hotel_content['SpecialOffers'][$lang]; ?>
                    </td>
                </tr>
                <tr>
                    <td style="padding:10px" align="left" valign="top">
                        <p>Note: kindly be informed that, your booking has not
                            been paid yet. Credit card verification and/or full
                            payment may be requested upon your check-in.</p>
                    </td>
                </tr>
                <tr>
                    <td style="padding:10px" align="left" valign="top">
                        <?php
                        if (isset($hotel_content['Cancelations'][$lang]))
                            echo $hotel_content['Cancelations'][$lang];
                        else
                            echo $hotel_content['Cancelations'];
                        ?>

                    </td>
                </tr>
            </tbody>
        </table>
    </body>
</html>